package com.example.lin.day9_11;

import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import java.io.File;

public class DetailActivity extends AppCompatActivity {

    private TextView tv_show;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);


        tv_show = findViewById(R.id.tv_show);

        Intent intent = getIntent();


        String key = intent.getStringExtra("key");
        tv_show.setText(key);


//        NotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
//        if (manager != null) {
//            //取消该应用程序发送的所有通知
//            manager.cancel(MainActivity.NOTIFY_ID);
//        }
    }


//    public static Intent getApkInstall(String filepath, Context context) {
//        File file = new File(filepath);
//        Intent intent = new Intent(Intent.ACTION_VIEW);
//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//        Uri apkUri;
//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // 7.0+以上版本
//            apkUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file); //与manifest中定义的provider中的authorities=".provider"保持一致
//            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
//        } else {
//            apkUri = Uri.fromFile(file);
//        }
//        intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//        return intent;
//    }
}
